-
Notifications
You must be signed in to change notification settings - Fork 527
Fix for fn call when def argument is interface. #600
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -243,7 +243,7 @@ private static bool CheckFloatSyntax(Type desugared, Statement statement, ref st | |||
if (enumItem != null) | |||
{ | |||
result = string.Format("{0}{1}.{2}", | |||
desugared.IsPrimitiveType() ? "(int) " : string.Empty, | |||
desugared.IsPrimitiveType() ? "(int) " : "(" + desugared.CSharpType(new CSharpTypePrinter(Driver)) + ") ", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please break the line after the colon and use string.Format instead.
@genuinelucifer you should be able to call GetFinalPointee() on param.Type or desugared (not sure which one, you'll have to check) and then use TryGetClass (or a similar name, you'll find it easily, it's widely used). Then you can check Class.IsInterface. Just a note: GetFinalPointee() returns null if the type is not a pointer so you have to use type.GetFinalPointee() ?? type. A really stupid bug we need to fix but for the time being this is the way to ensure you don't get a null crash. |
Actually I already tried that and a few other things but couldn't get it to work. |
@ddobrev I guess it's good to go now. Please review. |
@genuinelucifer Happy New Year! I wish you health, happiness and many more commits to C++#. :) |
@ddobrev Thanks and same to you :) |
3fafe21
to
347d0cd
Compare
Fix for fn call when def argument is interface.
@genuinelucifer thank you. Let me know when you are ready for more work. |
I actually don't have much work for the next 1 month or so. So, i am free.
Pls provide the next issue for me to work on.
|
Great. :) You've been doing such excellent work that I think you are ready for the next level. There's a relatively simple issue which is very suitable to get you acquainted with the C++ part. #601 requires you to add the new field to our AST.h and then read it in the parser and in ASTConverter. Any questions are welcome. |
Ohh good. Thanks. I'll try it and ask you if any questions arise. :)
|
This is my initial thought as I found that
desugered
is always the class required. I couldn't find a way to figure out if the parameter type is interface. So, probably it will change as currently it generates the cast for every argument whether required or not.